package redis

import (
	"context"
	"errors"
	"time"
)

// redis存储短信验证码
func SetSendSms(mobile string, code string) error {
	err := RdbClient.Set(context.Background(), "send_sms"+mobile, code, time.Minute*10).Err()
	if err != nil {
		return errors.New("存储短信验证码失败")
	}
	return nil
}
func GetSendSms(mobile string) (string, error) {
	result, err := RdbClient.Get(context.Background(), "send_sms"+mobile).Result()
	if err != nil {
		return "", errors.New("获取短信验证码失败")
	}
	return result, nil
}
